import 'package:flutter/material.dart';

class TaskContainer extends StatelessWidget {
  final Color color;
  final String taskName;
  final String personName;
  final String desc;
  final String date;

  TaskContainer(
      {this.color, this.taskName, this.personName, this.date, this.desc});

  @override
  Widget build(BuildContext context) {
    final Color textColor = Colors.white;
    return Container(
      constraints: BoxConstraints(
        minHeight: 5.0,
        maxHeight: 30.0,
      ),
      width: 170,
      child: Card(
        shadowColor: Colors.black.withOpacity(.3),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(10.0),
        ),
        color: Colors.white,
        elevation: 2,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Container(
              padding: const EdgeInsets.all(4),
              decoration: BoxDecoration(
                color: color,
                borderRadius: BorderRadius.vertical(top: Radius.circular(10)),
              ),
              child: Column(
                mainAxisSize: MainAxisSize.max,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      Expanded(
                        flex: 2,
                        child: Column(
                          children: <Widget>[
                            Icon(Icons.sticky_note_2,
                                size: 16, color: textColor)
                          ],
                        ),
                      ),
                      Expanded(
                        flex: 8,
                        child: Text(
                          taskName,
                          style: TextStyle(
                            color: textColor,
                            fontSize: 13.0,
                            fontWeight: FontWeight.w500,
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      Expanded(
                        flex: 2,
                        child: Column(
                          children: <Widget>[
                            Icon(Icons.access_time, size: 16, color: textColor)
                          ],
                        ),
                      ),
                      Expanded(
                        flex: 8,
                        child: Text(date,
                            style: TextStyle(
                                color: textColor,
                                fontSize: 13.0,
                                fontWeight: FontWeight.w500)),
                      ),
                    ],
                  ),
                ],
              ),
            ),
            Container(
              padding: const EdgeInsets.all(6),
              height: 80,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Column(
                      children: <Widget>[
                        Text(desc != "" ? desc : "NO DESCRIPTION",
                            style: TextStyle(
                                color: Colors.black,
                                fontSize: 10.0,
                                fontWeight: FontWeight.w500)),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
